POV-Ray : Newsgroups : povray.general : Camera look_at question : Re: Camera look_at question Server Time
3 Aug 2024 20:20:24 EDT (-0400)
  Re: Camera look_at question  
From: Philippe Debar
Date: 24 Jan 2004 10:45:40
Message: <40129324@news.povray.org>
Tom Melly wrote:

>>What is the problem ? Understanding shearing,
> Yes - but I can at least see what it does (sort of - I don't really understand
> why it helps so much with the perspective problem)

What is needed to solve the perspective problem is to set up
non-perpendicular right, up and direction camera vectors. Shearing
allows to do exactly that : when you shear a box, edges that were
perpendicular (may) form another angle.

However, shearing isn't _required_ as you can set your vectors the way you
need them directly.

>>the matrix
> Yes - although, like quantum physics, it makes sense for about 5 mins after
> reading that faq on 'em.

Whenever I try to use the matrix keyword, I need to re-rtfm. Then fail
some times before succeeding.

>>or how to set up the camera ?
> Yes - this is where I really get into trouble. I've read the docs on the camera
> several times, and still can't get my head around the various options and how
> they interact.

Ok, I'll try to explain.

A (perspective) camera only really needs four vector parameters : 
location, up, right
and direction.

sky, look_at and angle are only tools to set up the four needed vectors.

Usually, and whenever you use look_at, the right, up and direction
vectors are perpendicular (just like x, y, z - in that order).

I feel that the best explanation to understand how the camera works is 
to use a real world example.

Some people, wanting to explore the effects of perspective, use the 
following setup : they paint what they can see trough a pane of glass on 
the glass itself. The camera works almost exactly in the same way.

location defines where the painter is standing in the scene - more 
exactly where his eye is set (supposing the other eye is closed).

right, up and direction define the position and dimensions of the pane 
of glass.

right measures the horizontal side of the glass pane, up it's vertical 
side. As up and right are vectors, they define the size and the 
orientation of the glass pane in one go.

direction is the vector joining the eye of the painter (=location) to 
the center of the pane. Hence, it defines the pane position (relative to 
the painter ; location + direction is the absolute pane's position).

look_at make the pane of glass rotate around the painter's eye. To 
achieve this it changes the value of up, right and direction. sky is 
used to determine how to rotate (keeping one's up up)

How much of the scene is painted depends on the relation between 
direction and the size of the pane (= right and up). If you multiply 
right, up and direction by a same number, the resulting image is left 
unchanged.

angle measures (and affects) the direction/right ratio.


If right and up aren't perpendicular, this means that the painter is 
using a parallelogram of glass to paint on. However, as pov always draw 
the image in a rectangle, the parallelogram is sheared onto the 
rectangle, producing a skewed image.


If direction is perpendicular to right and up, the center of the image 
is the point that is the nearest to the painter, and the intersection of 
the perpendicular traced from the painter to the pane, and the pane.

Setting direction non-perpendicular to right and up is like making the 
glass pane slide in it's own plane : the painter isn't painting around 
the center anymore. This is exactly like using a partial render of a 
larger image.


If you want to experiment with sheared cameras, that is cameras with 
non-perpendicular right, up and direction, you have to remember (1) to 
disable vista buffers with -uv and (2) that using look_at straighten 
right, up and direction back to perpendicular, so you need either to set 
up the right, up, direction vectors directly and avoid look_at or to use 
look_at and then shear the camera.


I hope I did not make any error and that this helps...

Povingly,

Philippe


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.